package com.woniuxy.microfixeddepositserver.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.woniuxy.bean.bank.BankBean;
import com.woniuxy.microfixeddepositserver.bean.FundManagerBean;
import com.woniuxy.microfixeddepositserver.dao.FundManagerDao;
import com.woniuxy.microfixeddepositserver.service.IFundManagerService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author: masterhai
 * @date: 2021/4/7:11:34
 * @description: 基金经理服务
 */
@Service
public class FundManagerServiceImpl implements IFundManagerService {
    @Resource
    private FundManagerDao fundManagerDao;

    @Override
    public PageInfo<FundManagerBean> selectAll (Integer page,Integer limit) {
        PageHelper.startPage(page, limit);
        List<FundManagerBean> fundManagerBeans = fundManagerDao.selectAll();
        PageInfo<FundManagerBean> infos = new PageInfo<>(fundManagerBeans);
        return infos;

    }

    @Override
    public void addManager (FundManagerBean fundManagerBean) {
        fundManagerDao.addManager(fundManagerBean);
    }

    @Override
    public int deleteByPrimaryKey (Integer id) {
        return fundManagerDao.deleteByPrimaryKey(id);
    }

    @Override
    public int updateByPrimaryKey (FundManagerBean fundManager) {
        return fundManagerDao.updateByPrimaryKey(fundManager);
    }

    @Override
    public FundManagerBean getManagerById(Integer id) {
        return fundManagerDao.getManagerById (id);
    }

    @Override
    public PageInfo<FundManagerBean> findByName (Integer page1, Integer limit1, FundManagerBean fundManagerBean) {
        PageHelper.startPage(page1, limit1);
        List<FundManagerBean> fundManagerBeans=fundManagerDao.findByName("%"+fundManagerBean.getMname()+"%");
        PageInfo<FundManagerBean> infos = new PageInfo<>(fundManagerBeans);
        return infos;
    }

    @Override
    public List<FundManagerBean> selectAllInfos () {
        return fundManagerDao.selectAll();
    }
}
